<?php

session_start();

function __autoload($class){
    $file= __DIR__.'/'.strtolower($class).'.php';
    if(is_file($file)){
        include_once $file;
    }
    return '';
}

print_r($_POST);
echo '<br/>';

$username = $_POST['username'];
$password = $_POST['password'];

//echo $username,'->',$password;

$user = new User($username,$password);
try{
    Validata::validataUser($user);
    $_SESSION['username']=$username;
    header('Location:main.php');
}catch(MyException $e){
    header('Location:index.php');
}


